<template>
  <div>
    <el-menu :default-active="activeIndex" class="el-menu-demo" router mode="horizontal" @select="handleSelect">
      <el-menu-item index="/lunbo" class="zuobian">首页</el-menu-item>
      <el-menu-item index="/tingche" class="zuobian">车辆出入库</el-menu-item>
      <el-menu-item index="/geren" class="zuobian">个人中心</el-menu-item>
      <el-menu-item index="/fankui" class="zuobian">反馈</el-menu-item>
      <el-menu-item index="/recharge" class="zuobian">充值</el-menu-item>
      <el-menu-item style="position: relative;left: 700px">
        {{username}}
        <el-button style="position: relative;left: 10px" @click="tuichu()">退出</el-button>
      </el-menu-item>
    </el-menu>
  </div>
</template>

<script>
export default {
  name: "top",
  data() {
    return {
      activeIndex: '1',
      activeIndex2: '1',
      username: window.localStorage.getItem("username")
    };
  },
  methods: {
    handleSelect(key, keyPath) {
      console.log(key, keyPath);
    },
    tuichu(){
      window.localStorage.clear()
      this.$router.push('/login')
    }
  }
}
</script>

<style scoped>
  .zuobian{
    position: relative;
    left: 400px;
  }

</style>
